package com.example.spring.controller;

import com.example.spring.utils.SpringContextHolder;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisCluster;

import java.util.Map;
import java.util.UUID;

/**
 * Created by Administrator on 2017-9-7.
 */

@RestController
@RequestMapping(value = "/test")
public class EventTest  {

    @Autowired
    JedisCluster jedisCluster;

    @RequestMapping(value = "/testRedis")
    public String loadUser(){
//        TestRedis t = new TestRedis();
//        t.loadToken();

        String token = UUID.randomUUID().toString();
        jedisCluster.set("user_"+token,"dididadadididada");
        Map map = Maps.newHashMap();
        map.put("redis_"+token,"imhappy");
        jedisCluster.hmset("redis_"+token,map);

        return "token set success";
    }

}
